package com.atguigu.yygh.sms.listener;

import com.atguigu.yygh.mq.constant.MessageQueueContant;
import com.atguigu.yygh.vo.msm.MsmVo;
import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class SmsListener {

    @RabbitListener(bindings = {
            @QueueBinding(exchange =@Exchange(value = MessageQueueContant.EXCHANGE_SMS),
            value = @Queue(MessageQueueContant.QUEUE_SMS),
            key = MessageQueueContant.ROUTING_KEY_SMS)
    })
    public void consume(MsmVo msmVo, Message message, AMQP.Channel channel){
        String phone = msmVo.getPhone();
        System.out.println("给就诊人发送短信提示"+phone);
    }
}